// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://192.168.101.27:9535/WebServiceEntry?wsdl
// >Import : http://192.168.101.27:9535/WebServiceEntry?wsdl>0
// >Import : http://192.168.101.27:9535/WebServiceEntry?xsd=1
// >Import : http://192.168.101.27:9535/WebServiceEntry?wsdl>1
// >Import : http://192.168.101.27:9535/WebServiceEntry?xsd=2
// Encoding : UTF-8
// Version  : 1.0
// (2017-12-15 8:53:03 - - $Rev: 86412 $)
// ************************************************************************ //

unit WebServiceEntry1;

interface

uses
  Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns;

const
  IS_OPTN = $0001;
  IS_UNBD = $0002;
  IS_NLBL = $0004;
  IS_UNQL = $0008;

type

  // ************************************************************************ //
  // The following types, referred to in the WSDL document are not being represented
  // in this file. They are either aliases[@] of other types represented or were referred
  // to but never[!] declared in the document. The types from the latter category
  // typically map to predefined/known XML or Embarcadero types; however, they could also
  // indicate incorrect WSDL documents that failed to declare or import a schema type.
  // ************************************************************************ //
  // !:int             - "http://www.w3.org/2001/XMLSchema"[]
  // !:string          - "http://www.w3.org/2001/XMLSchema"[Lit][Gbl]

  Exception2 = class; { "http://ws.adapter.bsoft.com/"[GblCplx] }

  Exception = class; { "http://ws.adapter.bsoft.com/"[Flt][GblElm] }



  // ************************************************************************ //
  // XML       : Exception, global, <complexType>
  // Namespace : http://ws.adapter.bsoft.com/
  // ************************************************************************ //

  Exception2 = class(TRemotable)
  private
    Fmessage_: string;
    Fmessage__Specified: boolean;
    procedure Setmessage_(Index: Integer; const Astring: string);
    function message__Specified(Index: Integer): boolean;
  published
    property message_: string index(IS_OPTN or IS_UNQL)read Fmessage_ write Setmessage_ stored message__Specified;
  end;

  // ************************************************************************ //
  // XML       : Exception, global, <element>
  // Namespace : http://ws.adapter.bsoft.com/
  // Info      : Fault
  // Base Types: Exception
  // ************************************************************************ //
  Exception = class(ERemotableException)
  private
    Fmessage_: string;
    Fmessage__Specified: boolean;
    procedure Setmessage_(Index: Integer; const Astring: string);
    function message__Specified(Index: Integer): boolean;
  published
    property message_: string index(IS_OPTN or IS_UNQL)read Fmessage_ write Setmessage_ stored message__Specified;
  end;

  stringArray = array of string; { "http://jaxb.dev.java.net/array"[GblCplx] }

  // ************************************************************************ //
  // Namespace : http://ws.adapter.bsoft.com/
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : rpc
  // use       : literal
  // binding   : WebServiceEntryPortBinding
  // service   : WebServiceEntryService
  // port      : WebServiceEntryPort
  // URL       : http://192.168.101.27:9535/WebServiceEntry
  // ************************************************************************ //

  WebServiceEntry = interface(IInvokable)
    ['{6B27715B-B45A-F875-37E1-EAAD2536EC74}']

    // Cannot unwrap:
    // - Input message has more than one part
    // - Output part does not refer to an element
    function invoke(const arg0: string; const arg1: string; const arg2: string; const arg3: string;
      const arg4: stringArray): string; stdcall;
    procedure startWs; stdcall;

    // Cannot unwrap:
    // - Input message has more than one part
    // - Output part does not refer to an element
    function transportData(const arg0: string; const arg1: string; const arg2: Integer; const arg3: string)
      : string; stdcall;
  end;

function GetWebServiceEntry(UseWSDL: boolean = System.False; Addr: string = ''; HTTPRIO: THTTPRIO = nil)
  : WebServiceEntry;

implementation

uses
  System.SysUtils, DM_Frm;

function GetWebServiceEntry(UseWSDL: boolean; Addr: string; HTTPRIO: THTTPRIO): WebServiceEntry;
const
  // defWSDL = 'http://192.168.101.27:9535/WebServiceEntry?wsdl';
  // defURL  = 'http://192.168.101.27:9535/WebServiceEntry';
  defSvc = 'WebServiceEntryService';
  defPrt = 'WebServiceEntryPort';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
    begin
      Addr := 'http://' + DM.ConfigIniFileRead('Config.ini', 'QuYuPingTaiWebService', 'ServerName') +
        ':9535/WebServiceEntry?wsdl';
      // Addr := defWSDL
    end
    else
    begin
      Addr := 'http://' + DM.ConfigIniFileRead('Config.ini', 'QuYuPingTaiWebService', 'ServerName') +
        ':9535/WebServiceEntry';
      // Addr := defURL;
    end;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as WebServiceEntry);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end
    else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;

procedure Exception2.Setmessage_(Index: Integer; const Astring: string);
begin
  Fmessage_ := Astring;
  Fmessage__Specified := True;
end;

function Exception2.message__Specified(Index: Integer): boolean;
begin
  Result := Fmessage__Specified;
end;

procedure Exception.Setmessage_(Index: Integer; const Astring: string);
begin
  Fmessage_ := Astring;
  Fmessage__Specified := True;
end;

function Exception.message__Specified(Index: Integer): boolean;
begin
  Result := Fmessage__Specified;
end;

initialization

{ WebServiceEntry }
InvRegistry.RegisterInterface(TypeInfo(WebServiceEntry), 'http://ws.adapter.bsoft.com/', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(WebServiceEntry), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(WebServiceEntry), ioLiteral);
{ WebServiceEntry.invoke }
InvRegistry.RegisterParamInfo(TypeInfo(WebServiceEntry), 'invoke', 'arg4', '',
  '[Namespace="http://jaxb.dev.java.net/array", ArrayItemName="item"]');
RemClassRegistry.RegisterXSClass(Exception2, 'http://ws.adapter.bsoft.com/', 'Exception2', 'Exception');
RemClassRegistry.RegisterExternalPropName(TypeInfo(Exception2), 'message_', '[ExtName="message"]');
RemClassRegistry.RegisterXSClass(Exception, 'http://ws.adapter.bsoft.com/', 'Exception');
RemClassRegistry.RegisterExternalPropName(TypeInfo(Exception), 'message_', '[ExtName="message"]');
RemClassRegistry.RegisterXSInfo(TypeInfo(stringArray), 'http://jaxb.dev.java.net/array', 'stringArray');

end.
